package com.dayuanit.dy15.ebook.bookshop.util;

import com.dayuanit.dy15.ebook.bookshop.dto.CommodityDTO;
import com.dayuanit.dy15.ebook.bookshop.dto.CommodityHomeDTO;
import com.dayuanit.dy15.ebook.bookshop.entity.Commodity;

public class BookUtils {

    public static CommodityDTO converter2DTO(String pictureUrl, Commodity commodity) {
       return CommodityDTO.builder()
                .author(commodity.getAuthor())
                .commoId(commodity.getId())
                .commoName(commodity.getCommoName())
                .pictureUrl(pictureUrl + commodity.getPictureName())
                .price(commodity.getPrice())
                .profile(commodity.getProfile())
                .publisher(commodity.getPublisher())
                .publisherTime(commodity.getPublisherTime())
                .stock(commodity.getStock())
                .wordNum(commodity.getWordNum())
                .build();
    }

}
